<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="default">
    <meta name="format-detection" content="telphone=no, email=no">
    <link rel="stylesheet" href="__EXTEND__/business/css/common.css">
    <link rel="stylesheet" href="__EXTEND__/business/css/index.css"/>
    <script src="__EXTEND__/business/js/resize.js"></script>
    <link rel="stylesheet" href="__EXTEND__/business/css/register.css"/>
    <script src="__JS__/jquery-3.1.0.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
    <title>我要创业</title>
</head>
<body class="cy_body">
<div class="top">
    <div class="txt"><img src="__EXTEND__/business/images/cy_wz.png" alt=""></div>
</div>
<form action="{:U('Home/Business/index')}" method="post" id='send'>
    <input type="hidden" name="pid" value="{$pid}">
    <div class="main">
        <div class="form_group">
            <div class="form_item">
                <input type="text" placeholder="请输入微信号" class="form_in" name="weixin">
            </div>
            <div class="form_item">
                <input type="text" placeholder="请输入姓名" class="form_in" name="name">
            </div>
            <div class="form_item">
                <input type="text" placeholder="请输入手机号码" class="form_in" name="telephone">
            </div>
            <div class="form_item">
                <input type="text" placeholder="请输入备注" class="form_in" name="remark">
            </div>
            <div class="form_item">
                <a href="javascript:void(0)" class="btn submit_btn" id='submit_info'>提交</a>
            </div>
        </div>
    </div>
</form>
</body>
<script type="text/javascript">
    $('#submit_info').click(function(){
        var pid = $('input[name="pid"]').val();
        if(!pid){
            layer.msg('无效分享链接',{icon:2,time:1000});
            return false;
        }
        var weixin = $('input[name="weixin"]').val();
        var name = $('input[name="name"]').val();
        var telephone = $('input[name="telephone"]').val();

        if(!(/^1[34578]\d{9}$/.test(telephone))){
            layer.msg('手机号码有误，请重填',{icon:2,time:1000});
            return false;
        }
        var remark = $('input[name="remark"]').val();
        $.ajax({
            type: 'POST',
            url: "{:U('Home/Business/index')}",
            data: {
                pid:pid,
                weixin:weixin,
                name:name,
                telephone:telephone,
                remark:remark,
            },
            dataType: 'json',
            success: function(data){

                if(data.status){
                    layer.msg(data.info,{icon:1,time:1000});
                    setTimeout((function() {
                        {:C("URL_HTML_SUFFIX","")}
//                        window.location.href="{:U('Home/MicroMall/PayOrder')}"+"/oid/"+data.info;
                    }), 500);
                }else{
                    layer.msg(data.info,{icon:2,time:1000});
                }
            },
            error:function(data) {
                console.log(data.msg);
            },
        });
    });
</script>
</html>